package cn.th.controller;


import cn.th.common.R;
import cn.th.entity.Gift;
import cn.th.entity.UserGift;
import cn.th.service.IGiftService;
import cn.th.service.IUserGiftService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.Map;

/**
 * <p>
 * 用户-礼品-联系表 前端控制器
 * </p>
 *
 * @author cn.th
 * @since 2024-03-30
 */
@Slf4j
@RestController
@RequestMapping("/userGift")
public class UserGiftController {
    @Autowired
    private IUserGiftService userGiftService;

    /**
     * 新增用户所兑换的礼品
     * @param userGift
     * @return
     */
    @PostMapping
    public R<?> save(@RequestBody UserGift userGift) {
        log.info("userGift:{}", userGift);
        userGiftService.save(userGift);
        return R.success(userGift,"用户新增礼物成功");
    }

}

